var example=[1,4,3,8,9,6,2];
function quickSort1(arr) {
  if(arr.length <= 1) {
    return arr
  }
  var left=[],right=[],current=arr.splice(0,1);
  for(let i = 0; i < arr.length; i++) {
    if(arr[i] < current) {
      left.push(arr[i])
    } else {
      right.push(arr[i])
    }
  }
  return quickSort1(left).concat(current,quickSort1(right))
}
console.log(quickSort1(example))